package com.khoinguyen.feedtweet.dao;

import java.util.ArrayList;
import java.util.List;

import org.apache.ibatis.exceptions.PersistenceException;
import org.apache.ibatis.session.SqlSession;

import com.khoinguyen.feedtweet.model.VOUser;

public class UserDao extends Dao {
	public static List<VOUser> getAllUsers() {
		List<VOUser> users = new ArrayList<VOUser>();
		SqlSession session = sqlSessionFactory.openSession();
		users = session.selectList("getAllUsers");
		session.close();
		return users;
	}

	public static void insertUser(VOUser user) {
		SqlSession session = sqlSessionFactory.openSession(true);
		try {
			session.insert("insertTwitterUser", user);
		} catch (PersistenceException e) {
			e.printStackTrace();
		}
		session.close();
	}
}
